<template>
  <div class="dashboard-container">
    <div class="dashboard-text">{{ hello+name }}</div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
  name: 'Dashboard',
  computed: {
    ...mapGetters([
      'name'
    ]),
    hello() {
      const h = new Date().getHours()
      let hello = ''
      switch (true) {
        case h < 3:
          hello = '深夜好'
          break
        case h < 6:
          hello = '凌晨好'
          break
        case h < 9:
          hello = '早上好'
          break
        case h < 12:
          hello = '上午好'
          break
        case h === 12:
          hello = '中午好'
          break
        case h < 18:
          hello = '下午好'
          break
        case h < 24:
          hello = '晚上好'
          break
      }
      return hello
    }
  }
}
</script>

<style lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}
</style>
